//
//  DrawBackSuccessController.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 16/10/13.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "DrawBackSuccessController.h"
#import "OilOrderViewController.h"
#import "CoastOrderViewController.h"


@interface DrawBackSuccessController ()


@end

@implementation DrawBackSuccessController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    [self addSubView];
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.title = @"退款成功";
}



- (void)addSubView
{

    UIImage *image = [UIImage imageNamed:@"icon_logo"];
    UIImageView *payImage = [[UIImageView alloc] initWithImage:image];
    [self.view addSubview:payImage];
    
    [payImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(self.view.mas_top).offset(20);
        make.width.mas_equalTo(WIDTH/5*1.25);
        make.height.mas_equalTo(self.view.width/5);
        
    }];
    
    
    UILabel *label = [[UILabel alloc] init];
    label.textAlignment = NSTextAlignmentCenter;
    label.font = [UIFont systemFontOfSize:18];
    label.font = [UIFont boldSystemFontOfSize:18];
    label.textColor = DEFAULT_COLOR;
    label.text = @"退款成功";
    [self.view addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(payImage.mas_bottom).offset(25);
        
    }];
    
    
    UILabel *secondLabel = [[UILabel alloc] init];
    secondLabel.textAlignment = NSTextAlignmentCenter;
    secondLabel.textColor = [UIColor grayColor];
    secondLabel.font = [UIFont systemFontOfSize:13];
    secondLabel.text = @"订单退款成功后,会自动将所支付的消费额或者积分返回您的账户中,该商品由亿乐购物吧提供";
    secondLabel.numberOfLines = 0;
    [self.view addSubview:secondLabel];
    
    
    [secondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(label.mas_bottom).offset(10);
        make.width.mas_equalTo(WIDTH/5*4);
        
    }];
    
    

    UIButton *button = [[UIButton alloc] init];
    [self.view addSubview:button];
    [button setTitle:@"完  成" forState:UIControlStateNormal];
    [button setBackgroundColor:DEFAULT_COLOR];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.layer.cornerRadius = 3;
    button.layer.masksToBounds = YES;
    button.titleLabel.font = FONT(15);
    [button addTarget:self action:@selector(drawBackSuccessDidClick) forControlEvents:UIControlEventTouchUpInside];
   
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(secondLabel.mas_bottom).offset(30);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(WIDTH/5*4);
        
    }];
}

- (void)drawBackSuccessDidClick
{
    
     [self.navigationController popToRootViewControllerAnimated:YES];
//    if ([_type isEqualToString:@"2"]) {
//        //加油卡
//        OilOrderViewController *OilOrderVC = [[OilOrderViewController alloc] init];
//        [self.navigationController pushForm:self.navigationController pushToAndHidden:OilOrderVC];
//    }else{
//        //话费
//        CoastOrderViewController *CoastOrderVC = [[CoastOrderViewController alloc] init];
//        [self.navigationController pushForm:self.navigationController pushToAndHidden:CoastOrderVC];
//    }
   
}

@end
